package leetcode.other;

/**
 * @author cyt
 * @create 2020-07-30 8:51
 */
public class T343 {
    /**
     * 尽可能拆分出多的 3
     * @param args
     */
    public static void main(String[] args) {
        System.out.println(integerBreak(10));

    }

    public static int integerBreak(int n) {
        if(n <= 3) {
            return n - 1;
        }
        int a = n / 3;
        int b = n % 3;
        if(b == 0) return (int)Math.pow(3, a);
        if(b == 1) return (int)Math.pow(3, a - 1) * 4;
        return (int)Math.pow(3, a) * 2;
    }
}
